﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MVCMusicStore.Helpers
{
    public static class HtmlHelpers
    {
        /// <summary>
        /// Note the paramter "this System.Web.Mvc.HtmlHelper helper" -> extending the class HtmlHelper
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="s"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        public static string Truncate(this System.Web.Mvc.HtmlHelper helper, string s, int length)
        {
            if (s.Length > length)
                return s.Substring(0, length) + " ...";
            return s;
        }
    }
}